<template>
  <div class="dashboard-editor-container">

    <panel-group @handleSetLineChartData="handleSetLineChartData" />

    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <today-check-line-chart :chart-data="lineChartData" v-if="lineChartData.expectedData.length >0"/>
    </el-row>

    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <construnction-status-chart />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <construnction-problem-chart />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <month-check-chart />
        </div>
      </el-col>
    </el-row>


  </div>
</template>

<script>
import PanelGroup from './bigscreen/PanelGroup'
import TodayCheckLineChart from './bigscreen/TodayCheckLineChart'
import ConstrunctionStatusChart from './bigscreen/ConstrunctionStatusChart'
import ConstrunctionProblemChart from './bigscreen/ConstrunctionProblemChart'
import MonthCheckChart from './bigscreen/MonthCheckChart'

import {selectTodayCheckTotal} from "@/api/statistics/bigScreen";

export default {
  name: 'BigScreen',
  components: {
    MonthCheckChart,
    ConstrunctionProblemChart,
    PanelGroup,
    TodayCheckLineChart,
    ConstrunctionStatusChart,
  },
  data() {
    return {
      lineChartData:{expectedData:[],actualData:[]},
    }
  },
  mounted() {
    this.getTodayCheckTotal();
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    },
    /** 获取今日检查数量统计 */
    getTodayCheckTotal() {
      selectTodayCheckTotal({}).then(response => {
        const { expectedData, actualData,deptData } = response.data;
        this.lineChartData.expectedData = expectedData;
        this.lineChartData.actualData = actualData;
        this.lineChartData.deptData = deptData;
      });
    },
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
